varying mediup vec4 eyespaceNormal;
varying lowp vec4 diffues;

uniform highp vec3 lightPosition;
uniform highp vec3 ambientMaterial;
uniform highp vec3 specularMaterial;
uniform highp float shininess;

void main(void)
{
highp vec3 n = normalize(eyespaceNormal);
highp vec3 l = normalize(lightPosition);
highp vec3 e = vec3(0, 0, 1);
highp vec3 h = normalize(l+e);

highp float df = max(0.0, dot(n, l));
highp float sf = max(0.0, dot(n, h));
sf = pow(sf, shininess);

/*
toon shading
if(df < 0.1)	dt = 0.0;
else if(df < 0.3) 	df = 0.3;
else if(df < 0.6) 	df = 0.6;
else df = 1.0;

sf = step(0.5, sf);
*/

lowp vec3 color = ambientMaterial + df * diffuseMaterial + sf * specularMaterial;
gl_FragColor = vec4(color, 1);
}
